<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>libwebsockets: Websocket Close</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="libwebsockets.org-logo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">libwebsockets
   </div>
   <div id="projectbrief">Lightweight C library for HTML5 websockets</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li class="current"><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__wsclose.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#enum-members">Enumerations</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Websocket Close</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="enum-members"></a>
Enumerations</h2></td></tr>
<tr class="memitem:gae399c571df32ba532c0ca67da9284985"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsclose.html#gae399c571df32ba532c0ca67da9284985">lws_close_status</a> { <br />
&#160;&#160;<b>LWS_CLOSE_STATUS_NOSTATUS</b> = 0, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4">LWS_CLOSE_STATUS_NORMAL</a> = 1000, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a9737a68759e739856b150ff9dfa30218">LWS_CLOSE_STATUS_GOINGAWAY</a> = 1001, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98">LWS_CLOSE_STATUS_PROTOCOL_ERR</a> = 1002, 
<br />
&#160;&#160;<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276">LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE</a> = 1003, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985af90cb98d983ad3d4c79df9b6f3d4a4d2">LWS_CLOSE_STATUS_RESERVED</a> = 1004, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a4b8a3b7ce6f731e5248e4b0fb64a5044">LWS_CLOSE_STATUS_NO_STATUS</a> = 1005, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a68b3d34bebd88547dcfa5cadba0acd6c">LWS_CLOSE_STATUS_ABNORMAL_CLOSE</a> = 1006, 
<br />
&#160;&#160;<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a7aef2da0062da606eeb35aaca5cf9050">LWS_CLOSE_STATUS_INVALID_PAYLOAD</a> = 1007, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5">LWS_CLOSE_STATUS_POLICY_VIOLATION</a> = 1008, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8">LWS_CLOSE_STATUS_MESSAGE_TOO_LARGE</a> = 1009, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e">LWS_CLOSE_STATUS_EXTENSION_REQUIRED</a> = 1010, 
<br />
&#160;&#160;<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350">LWS_CLOSE_STATUS_UNEXPECTED_CONDITION</a> = 1011, 
<a class="el" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390">LWS_CLOSE_STATUS_TLS_FAILURE</a> = 1015, 
<b>LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY</b> = 9999
<br />
 }</td></tr>
<tr class="separator:gae399c571df32ba532c0ca67da9284985"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:gaa1c863415d1783cd8de7938aa6efa262"><td class="memItemLeft" align="right" valign="top">LWS_VISIBLE LWS_EXTERN void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__wsclose.html#gaa1c863415d1783cd8de7938aa6efa262">lws_close_reason</a> (struct lws *wsi, enum <a class="el" href="group__wsclose.html#gae399c571df32ba532c0ca67da9284985">lws_close_status</a> status, unsigned char *buf, size_t len)</td></tr>
<tr class="separator:gaa1c863415d1783cd8de7938aa6efa262"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<h2>Websocket close frame control</h2>
<p>When we close a ws connection, we can send a reason code and a short UTF-8 description back with the close packet. </p>
<h2 class="groupheader">Enumeration Type Documentation</h2>
<a class="anchor" id="gae399c571df32ba532c0ca67da9284985"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="group__wsclose.html#gae399c571df32ba532c0ca67da9284985">lws_close_status</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
<p>enum lws_close_status - RFC6455 close status codes </p>
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4"></a>LWS_CLOSE_STATUS_NORMAL&#160;</td><td class="fielddoc">
<p>1000 indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a9737a68759e739856b150ff9dfa30218"></a>LWS_CLOSE_STATUS_GOINGAWAY&#160;</td><td class="fielddoc">
<p>1001 indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98"></a>LWS_CLOSE_STATUS_PROTOCOL_ERR&#160;</td><td class="fielddoc">
<p>1002 indicates that an endpoint is terminating the connection due to a protocol error. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276"></a>LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE&#160;</td><td class="fielddoc">
<p>1003 indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message). </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985af90cb98d983ad3d4c79df9b6f3d4a4d2"></a>LWS_CLOSE_STATUS_RESERVED&#160;</td><td class="fielddoc">
<p>Reserved. The specific meaning might be defined in the future. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a4b8a3b7ce6f731e5248e4b0fb64a5044"></a>LWS_CLOSE_STATUS_NO_STATUS&#160;</td><td class="fielddoc">
<p>1005 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that no status code was actually present. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a68b3d34bebd88547dcfa5cadba0acd6c"></a>LWS_CLOSE_STATUS_ABNORMAL_CLOSE&#160;</td><td class="fielddoc">
<p>1006 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed abnormally, e.g., without sending or receiving a Close control frame. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a7aef2da0062da606eeb35aaca5cf9050"></a>LWS_CLOSE_STATUS_INVALID_PAYLOAD&#160;</td><td class="fielddoc">
<p>1007 indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 [RFC3629] data within a text message). </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5"></a>LWS_CLOSE_STATUS_POLICY_VIOLATION&#160;</td><td class="fielddoc">
<p>1008 indicates that an endpoint is terminating the connection because it has received a message that violates its policy. This is a generic status code that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8"></a>LWS_CLOSE_STATUS_MESSAGE_TOO_LARGE&#160;</td><td class="fielddoc">
<p>1009 indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e"></a>LWS_CLOSE_STATUS_EXTENSION_REQUIRED&#160;</td><td class="fielddoc">
<p>1010 indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake. The list of extensions that are needed SHOULD appear in the /reason/ part of the Close frame. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350"></a>LWS_CLOSE_STATUS_UNEXPECTED_CONDITION&#160;</td><td class="fielddoc">
<p>1011 indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390"></a>LWS_CLOSE_STATUS_TLS_FAILURE&#160;</td><td class="fielddoc">
<p>1015 is a reserved value and MUST NOT be set as a status code in a Close control frame by an endpoint. It is designated for use in applications expecting a status code to indicate that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified). </p>
</td></tr>
</table>
<div class="fragment"><div class="line"><a name="l00553"></a><span class="lineno">  553</span>&#160;                      {</div><div class="line"><a name="l00554"></a><span class="lineno">  554</span>&#160;        LWS_CLOSE_STATUS_NOSTATUS                               =    0,</div><div class="line"><a name="l00555"></a><span class="lineno">  555</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4">LWS_CLOSE_STATUS_NORMAL</a>                                 = 1000,</div><div class="line"><a name="l00558"></a><span class="lineno">  558</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a9737a68759e739856b150ff9dfa30218">LWS_CLOSE_STATUS_GOINGAWAY</a>                              = 1001,</div><div class="line"><a name="l00561"></a><span class="lineno">  561</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98">LWS_CLOSE_STATUS_PROTOCOL_ERR</a>                           = 1002,</div><div class="line"><a name="l00564"></a><span class="lineno">  564</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276">LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE</a>                    = 1003,</div><div class="line"><a name="l00569"></a><span class="lineno">  569</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985af90cb98d983ad3d4c79df9b6f3d4a4d2">LWS_CLOSE_STATUS_RESERVED</a>                               = 1004,</div><div class="line"><a name="l00571"></a><span class="lineno">  571</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a4b8a3b7ce6f731e5248e4b0fb64a5044">LWS_CLOSE_STATUS_NO_STATUS</a>                              = 1005,</div><div class="line"><a name="l00576"></a><span class="lineno">  576</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a68b3d34bebd88547dcfa5cadba0acd6c">LWS_CLOSE_STATUS_ABNORMAL_CLOSE</a>                         = 1006,</div><div class="line"><a name="l00582"></a><span class="lineno">  582</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a7aef2da0062da606eeb35aaca5cf9050">LWS_CLOSE_STATUS_INVALID_PAYLOAD</a>                        = 1007,</div><div class="line"><a name="l00587"></a><span class="lineno">  587</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5">LWS_CLOSE_STATUS_POLICY_VIOLATION</a>                       = 1008,</div><div class="line"><a name="l00593"></a><span class="lineno">  593</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8">LWS_CLOSE_STATUS_MESSAGE_TOO_LARGE</a>                      = 1009,</div><div class="line"><a name="l00597"></a><span class="lineno">  597</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e">LWS_CLOSE_STATUS_EXTENSION_REQUIRED</a>                     = 1010,</div><div class="line"><a name="l00605"></a><span class="lineno">  605</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350">LWS_CLOSE_STATUS_UNEXPECTED_CONDITION</a>                   = 1011,</div><div class="line"><a name="l00609"></a><span class="lineno">  609</span>&#160;        <a class="code" href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390">LWS_CLOSE_STATUS_TLS_FAILURE</a>                            = 1015,</div><div class="line"><a name="l00616"></a><span class="lineno">  616</span>&#160;        <span class="comment">/****** add new things just above ---^ ******/</span></div><div class="line"><a name="l00617"></a><span class="lineno">  617</span>&#160;</div><div class="line"><a name="l00618"></a><span class="lineno">  618</span>&#160;        LWS_CLOSE_STATUS_NOSTATUS_CONTEXT_DESTROY               = 9999,</div><div class="line"><a name="l00619"></a><span class="lineno">  619</span>&#160;};</div><div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a7aef2da0062da606eeb35aaca5cf9050"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a7aef2da0062da606eeb35aaca5cf9050">LWS_CLOSE_STATUS_INVALID_PAYLOAD</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:582</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a2e1f0113494a58e762eed3d22e7080d8">LWS_CLOSE_STATUS_MESSAGE_TOO_LARGE</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:593</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad2b477a91c8445bf34ecd43977f9b390">LWS_CLOSE_STATUS_TLS_FAILURE</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:609</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a1bb501d212fa4d57053db681b1dfab98">LWS_CLOSE_STATUS_PROTOCOL_ERR</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:561</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad09e68295eabdddcba4e332fbea70ae5">LWS_CLOSE_STATUS_POLICY_VIOLATION</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:587</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a4b8a3b7ce6f731e5248e4b0fb64a5044"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a4b8a3b7ce6f731e5248e4b0fb64a5044">LWS_CLOSE_STATUS_NO_STATUS</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:571</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a68b3d34bebd88547dcfa5cadba0acd6c"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a68b3d34bebd88547dcfa5cadba0acd6c">LWS_CLOSE_STATUS_ABNORMAL_CLOSE</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:576</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a9737a68759e739856b150ff9dfa30218"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a9737a68759e739856b150ff9dfa30218">LWS_CLOSE_STATUS_GOINGAWAY</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:558</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ac6a161822783ee873be1c66f48d14e0e">LWS_CLOSE_STATUS_EXTENSION_REQUIRED</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:597</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a3ffa38d5081b85fb739e02a747ccf2c4">LWS_CLOSE_STATUS_NORMAL</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:555</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985a462c99b05459df700919cfd3f53c8276">LWS_CLOSE_STATUS_UNACCEPTABLE_OPCODE</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:564</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985af90cb98d983ad3d4c79df9b6f3d4a4d2"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985af90cb98d983ad3d4c79df9b6f3d4a4d2">LWS_CLOSE_STATUS_RESERVED</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:569</div></div>
<div class="ttc" id="group__wsclose_html_ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350"><div class="ttname"><a href="group__wsclose.html#ggae399c571df32ba532c0ca67da9284985ad0869604d79e13700ae5d196a431b350">LWS_CLOSE_STATUS_UNEXPECTED_CONDITION</a></div><div class="ttdef"><b>Definition:</b> libwebsockets.h:605</div></div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="gaa1c863415d1783cd8de7938aa6efa262"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">LWS_VISIBLE LWS_EXTERN void lws_close_reason </td>
          <td>(</td>
          <td class="paramtype">struct lws *&#160;</td>
          <td class="paramname"><em>wsi</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">enum <a class="el" href="group__wsclose.html#gae399c571df32ba532c0ca67da9284985">lws_close_status</a>&#160;</td>
          <td class="paramname"><em>status</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">unsigned char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>len</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p><code>#include &lt;<a class="el" href="libwebsockets_8h.html">lib/libwebsockets.h</a>&gt;</code></p>
<p>lws_close_reason - Set reason and aux data to send with Close packet If you are going to return nonzero from the callback requesting the connection to close, you can optionally call this to set the reason the peer will be told if possible.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">wsi</td><td>The websocket connection to set the close reason on </td></tr>
    <tr><td class="paramname">status</td><td>A valid close status from websocket standard </td></tr>
    <tr><td class="paramname">buf</td><td>NULL or buffer containing up to 124 bytes of auxiliary data </td></tr>
    <tr><td class="paramname">len</td><td>Length of data in </td></tr>
    <tr><td class="paramname">buf</td><td>to send </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
